<?php echo $this->Session->flash(); ?>

<script type="text/javascript">
    // increase the default animation speed to exaggerate the effect
           
    $(document).ready(function() {	
                 
        $('.tabla').dataTable({
            "bPaginate": false       
                       
        });
                
    });
</script>
<div class="paging">

</div>
<div class="proyects index">
    <table cellpadding="0" cellspacing="0" id="tabla">
        <thead>
            <tr>
                <th></th>
                <th><?php echo ('Monto'); ?></th>
                <th><?php echo ('Tipo'); ?></th>
                <th class="actions"><?php echo __('OPCIONES'); ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($payments as $payment): ?>
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td>Fecha de pago programado:</td>
                                <td><?php echo ($payment['Payment']['fecha_pago_programado']); ?>&nbsp;</td>
                            </tr>
                            <tr>
                                <td>Fecha de pago real:</td>
                                <td><?php echo ($payment['Payment']['fecha_pago_real']); ?>&nbsp;</td>
                            </tr>
                        </table>
                    </td>
                    <td><?php echo '$ ' . number_format($payment['Payment']['monto'], 2, ',', '.'); ?>&nbsp;</td>
                    <td style="width: 150px"><?php echo ($payment['Payment']['tipo']); ?>&nbsp;</td>

                    <td class="actions">
                        <?php
                        if ($usuario['User']['group_id'] == 1 or $usuario['User']['group_id'] == 7 or $usuario['User']['group_id'] == 22 or $usuario['User']['group_id'] == 2)
                            echo $this->Ajax->link('Editar', array('controller' => 'Payments', 'action' => 'edit2', $payment['Payment']['id']), array('update' => 'content', 'indicator' => 'loading', 'class' => 'actions', 'complete' => 'cargar()'));
                        else
                            echo $this->Ajax->link('Editar', array('controller' => 'Payments', 'action' => 'edit', $payment['Payment']['id']), array('update' => 'content', 'indicator' => 'loading', 'class' => 'actions', 'complete' => 'cargar()'));
                        ?>                       
                        <?php
                        if ($autorizado)
                            echo $this->Ajax->link('Borrar', array('controller' => 'Payments', 'action' => 'delete', $payment['Payment']['id'], $proyect_id), array('update' => 'content', 'indicator' => 'loading', 'class' => 'actions'), "¿Esta seguro que desea borrar el registro?");
                        ?><br><br>                       
                        <?php
                        echo $this->Ajax->link('Observaciones', array('controller' => 'PaymentReviews', 'action' => 'index', $payment['Payment']['id']), array('update' => 'content', 'indicator' => 'loading', 'class' => 'actions'));
                        ?>                       
                    </td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <table  border="0"  CellSpacing=10  align="center">
        <tbody>
            <tr>
                <td></p><?php echo $this->Ajax->link($this->Html->image("adicionar1.png", array('width' => '35', 'heigth' => '35', 'alt' => 'Adicionar pago')), array('controller' => 'Payments', "action" => 'add', $proyect_id), array('escape' => false, 'update' => 'content', 'indicator' => 'loading', 'complete' => 'cargar()')); ?></td>
            </tr>
        </tbody>
    </table>
</div>